#ifndef USER_CONFIG_H
#define USER_CONFIG_H

#include "framework.h"



sbit KEY_TEST_INPUT											= P0^0;
sbit LED_TEST_OUTPUT										= P1^2;




#if defined(NUVOTON)
	//use uart0
	//#define PIN_INIT()												MODIFY_HIRC_166();P00_Input_Mode();P12_PushPull_Mode();P06_PushPull_Mode();P07_Input_Mode();
	
	//use uart1
	#define PIN_INIT()												MODIFY_HIRC_166();P00_PushPull_Mode();P12_PushPull_Mode();P16_PushPull_Mode();P02_Input_Mode();
#elif defined(STC8A)
		#define PIN_INIT()											P1M1 = 0x01;P1M0 = 0xfe
#elif defined(STC8G)
		#define PIN_INIT()											P0M1 = 0x05;P0M0 = 0xfa;P1M1 = 0x01;P1M0 = 0xfe;
#elif defined(STC8H)
		#define PIN_INIT()											P1M1 = 0x01;P1M0 = 0xfe
#elif defined(SINONE)
	#define PIN_INIT()											
#endif
											



#define LED_TEST_ON()											LED_TEST_OUTPUT = 0
#define LED_TEST_OFF()										LED_TEST_OUTPUT = 1
#define LED_TEST_TOGGLE()									LED_TEST_OUTPUT = ~LED_TEST_OUTPUT




#define USER_CONFIG_DEFAULT()							LED_TEST_OFF();																
																				

#define USER_CONFIG()								PIN_INIT();USER_CONFIG_DEFAULT();



//------------------------------------------AD------------------------------------------------
#define AD_CHANNEL_INTERNAL_BOND_GAP								8
//--------------------------------------------------------------------------------------------


//--------------------------------------EVENT-------------------------------------------------
#define EVENT_KEY_TEST_SHORT_PRESS									0x0001
#define EVENT_KEY_TEST_LONG_PRESS										0x0002
#define EVENT_DETECT_VOLTAGE												0x0100
//--------------------------------------------------------------------------------------------


//--------------------------------------soft timers--------------------------------------------
//soft timer id
#define SOFT_TIMER_DETECT_VOLTAGE										0


//--------------------------------------soft timer interval------------------------------------
//soft timer interval
#define DETECT_VOLTAGE_INTERVAL											200		//ms
//---------------------------------------------------------------------------------------------



#endif
